// 对象的自变量
Page({
  // 数据
  data: {
    name: 'wls',
    age: 18,
    students: [
      {id: 110, name: 'wls0', age:  18},
      {id: 111, name: 'wls1', age:  19},
      {id: 112, name: 'wls2', age:  20},
      {id: 113, name: 'wls3', age:  21}
    ],
    counter: 0
  },
  // 加 函数
  handleBtnClick() {
    // 1. 错误的做法，界面不会刷新
    // this.data.counter += 1
    // console.log(this.data.counter)

    // 2. this.setData()
    this.setData({
      counter: this.data.counter += 1
    })
  },
  // 减
  handleSubClick() {
    // 2. this.setData()
    this.setData({
      counter: this.data.counter -= 1
    })
  }
})